home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Dev
/
Oberon
/
source
/
FPE
/
ToolDlg.mod
< prev
next >
Wrap
Text File
|
1995-06-29
|
6KB
|
226 lines
(***************************************************************************
$RCSfile: ToolDlg.mod $
Description: Defines and implements the tool editor dialog.
Created by: fjc (Frank Copeland)
$Revision: 1.10 $
$Author: fjc $
$Date: 1995/01/26 00:15:33 $
Copyright © 1993-1994, Frank Copeland.
This file is part of FPE.
See FPe.doc for conditions of use and distribution.
Log entries are at the end of the file.
***************************************************************************)
<* MAIN- *> <*$ LongVars+ *> <*$ NilChk- *>
MODULE ToolDlg;
IMPORT
SYS := SYSTEM, e := Exec, i := Intuition, ev := Events, is := IntuiSup,
isu := IntuiSupUtil, ise := ISupEvents, Data, tpl := ToolDlgTpl;
(* ===== Dialog ===== *)
TYPE
Dialog *= POINTER TO DialogRec;
DialogRec = RECORD (ise.ISupDialogRec)
accepted *: BOOLEAN;
template : tpl.Template;
toolInfo : Data.ToolInfo;
END; (* Dialog *)
DialogPort = POINTER TO DialogPortRec;
DialogPortRec = RECORD (ise.ISupPortRec)
dlg : Dialog
END; (* DialogPortRec *)
CONST
(* Gadget ID's *)
ButtonID = 0;
CommandID = 1;
ArgumentsID = 2;
IsActiveID = 3;
HasConsoleID = 4;
ConsoleID = 5;
StackID = 6;
AcceptID = 7;
CancelID = 8;
(* Requester definitions *)
RequesterTitle = "Tool information";
(*------------------------------------*)
PROCEDURE (dp : DialogPort) HandleISup
( msg : i.IntuiMessagePtr )
: INTEGER;
VAR gadget : INTEGER; string : e.LSTRPTR; value : LONGINT;
gadgetList : is.GadgetList; result : INTEGER;
BEGIN (* HandleISup *)
result := ev.Continue;
gadget := msg.code;
string := msg.iAddress;
value := SYS.VAL (LONGINT, msg.iAddress);
gadgetList := SYS.VAL (is.GadgetList, msg.specialLink);
CASE gadget OF
ButtonID: COPY (string^, dp.dlg.toolInfo.title);
|
CommandID: COPY (string^, dp.dlg.toolInfo.command);
|
ArgumentsID: COPY (string^, dp.dlg.toolInfo.arguments);
|
IsActiveID:
IF value = 0 THEN dp.dlg.toolInfo.isActive := FALSE
ELSE dp.dlg.toolInfo.isActive := TRUE
END
|
HasConsoleID:
IF value = 0 THEN
dp.dlg.toolInfo.hasConsole := FALSE;
dp.dlg.toolInfo.console := "";
isu.DisableGadget (gadgetList, ConsoleID, TRUE);
ELSE
dp.dlg.toolInfo.hasConsole := TRUE;
isu.DisableGadget (gadgetList, ConsoleID, FALSE);
END
|
ConsoleID: COPY (string^, dp.dlg.toolInfo.console);
|
StackID: dp.dlg.toolInfo.stack := value;
|
AcceptID: dp.dlg.accepted := TRUE; result := ev.Stop
|
CancelID: dp.dlg.accepted := FALSE; result := ev.Stop
|
END; (* CASE gadget *)
is.ReplyMsg (msg);
RETURN result
END HandleISup;
(*------------------------------------*)
PROCEDURE MakeDialog * (VAR toolDlg : Dialog);
VAR dp : DialogPort;
BEGIN (* MakeDialog *)
NEW (toolDlg);
tpl.InitTemplate (toolDlg.template);
toolDlg.reqData.title := SYS.ADR (RequesterTitle);
toolDlg.reqData.width := tpl.Width;
toolDlg.reqData.height := tpl.Height;
toolDlg.reqData.flags := {};
toolDlg.template.GadgetData.g0.default :=
SYS.ADR(toolDlg.toolInfo.title);
toolDlg.template.GadgetData.g1.default :=
SYS.ADR(toolDlg.toolInfo.command);
toolDlg.template.GadgetData.g2.default :=
SYS.ADR(toolDlg.toolInfo.arguments);
toolDlg.template.GadgetData.g6.default :=
SYS.ADR(toolDlg.toolInfo.console);
EXCL (toolDlg.reqData.flags, is.rdCenterWindow);
toolDlg.reqData.leftEdge := 40;
toolDlg.reqData.topEdge := 20;
toolDlg.reqData.gadgets :=
SYS.VAL (is.GadgetDataPtr, toolDlg.template.GadgetData);
NEW (dp); ASSERT (dp # NIL, 137);
dp.dlg := toolDlg;
toolDlg.iSupPort := dp;
END MakeDialog;
(*------------------------------------*)
PROCEDURE FreeDialog * (VAR toolDlg : Dialog);
BEGIN (* FreeDialog *)
tpl.CleanupTemplate (toolDlg.template);
SYS.DISPOSE (toolDlg.iSupPort); SYS.DISPOSE (toolDlg);
END FreeDialog;
(*------------------------------------*)
PROCEDURE Activate *
( toolDlg : Dialog;
VAR toolInfo : Data.ToolInfo;
window : i.WindowPtr);
(*------------------------------------*)
PROCEDURE SetupGadgets ();
BEGIN (* SetupGadgets *)
IF toolInfo.isActive THEN
toolDlg.template.GadgetData.g3.selected := 1;
ELSE
toolDlg.template.GadgetData.g3.selected := 0;
END; (* ELSE *)
IF toolInfo.hasConsole THEN
toolDlg.template.GadgetData.g4.selected := 1;
EXCL (toolDlg.template.GadgetData.g6.flags, is.gdDisabled);
ELSE
toolDlg.template.GadgetData.g4.selected := 0;
INCL (toolDlg.template.GadgetData.g6.flags, is.gdDisabled);
toolInfo.console := "";
END; (* ELSE *)
toolDlg.template.GadgetData.g8.default :=
SYS.VAL (e.APTR, toolDlg.toolInfo.stack);
END SetupGadgets;
BEGIN (* Activate *)
ASSERT (toolDlg # NIL, 137);
toolDlg.toolInfo := toolInfo; toolDlg.accepted := FALSE;
SetupGadgets ();
IF ise.Activate (toolDlg, window) THEN
IF toolDlg.accepted THEN toolInfo := toolDlg.toolInfo END
ELSE
isu.DoNotice (NIL, SYS.ADR ("ToolDlg"), "Failed to open dialog")
END;
END Activate;
END ToolDlg.
(***************************************************************************
$Log: ToolDlg.mod $
Revision 1.10 1995/01/26 00:15:33 fjc
- Release 1.5
Revision 1.9 1994/09/25 18:20:54 fjc
- Uses new syntax for external code declarations
Revision 1.8 1994/08/08 16:14:16 fjc
Release 1.4
Revision 1.7 1994/06/21 22:06:36 fjc
- HandleISup was RETURNing without calling ReplyIMsg().
Revision 1.6 1994/06/17 17:26:27 fjc
- Updated for release
Revision 1.5 1994/06/09 13:46:29 fjc
- [bug] Event handler was using the cooked message from
IntuiSup *after* replying to it.
Revision 1.4 1994/06/04 23:49:52 fjc
- Changed to use new Amiga interface
Revision 1.3 1994/05/12 21:26:09 fjc
- Prepared for release
Revision 1.2 1994/01/24 14:33:33 fjc
Changed to conform with changes in Module Handlers:
Handler procedures now reply to any messages they handle
Revision 1.1 1994/01/15 17:32:38 fjc
Start of revision control
***************************************************************************)